package edu.byu.intex2.data.bo;

import edu.byu.intex2.data.DataException;
import edu.byu.intex2.data.dao.WarrantyDAO;

/**
 * Warranty describes what the dealership will cover in case repairs are needed.
 * @author Brady
 */
public class Warranty extends BusinessObject {

    private int miles;
    private int months;
    private String type;

    /** Creates a new instance of BusinessObject */
    public Warranty(String id) {
        super(id);
    }//constructor

    /** Convenience method to call the correct DAO to save this business object */
    public void save() throws DataException {
        try {
            WarrantyDAO.getInstance().save(this);
        } catch (DataException e) {
            e.printStackTrace();
        }
    }

    /** @return the miles     */
    public int getMiles() {
        return miles;
    }

    /** @param miles the miles to set     */
    public void setMiles(int miles) {
        this.miles = miles;
        setDirty();
    }

    /** @return the months     */
    public int getMonths() {
        return months;
    }

    /** @param months the months to set    */
    public void setMonths(int months) {
        this.months = months;
        setDirty();
    }

    /** @return the type     */
    public String getType() {
        return type;
    }

    /** @param type the type to set     */
    public void setType(String type) {
        this.type = type;
        setDirty();
    }
}
